package unit10;

import java.awt.Container;
import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class Ex10_9_DialogBoxDemo extends JFrame {
    String dialogTitle = "消息对话框";
    String dialogMessage = "你好吗?";
    int dialogType = JOptionPane.QUESTION_MESSAGE; //定义对话框类型变量

    //构造方法
    public Ex10_9_DialogBoxDemo() {
        Container contentPane = getContentPane();
        contentPane.setLayout(new FlowLayout());
        //调用showMessageDialog方法，设置相关信息
        JOptionPane.showMessageDialog(null, dialogMessage, dialogTitle, dialogType);
    }

    public static void main(String[] args) {
        Ex10_9_DialogBoxDemo Jf = new Ex10_9_DialogBoxDemo();
        Jf.setSize(300, 200);
        Jf.setVisible(true);
        Jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
}
